import AdminService from '../services/AdminService.js'
import Resolve from '../utils/resolve.js'

const res = new Resolve()

class AdminController
{
    async login(ctx) 
    {
        const data = await AdminService.login(ctx.request.body)
        ctx.body = res.json(data)
    }

    async info(ctx) {
        const { username, avatar } = ctx.auth
        
        ctx.body = res.json({
            name: username,
            roles: ['Admin'],
            avatar
        })
    }
}

export default AdminController